package com.yizn.learn.springext.getspringcontex;

import com.yizn.learn.springext.getspringcontex.ApplicationContextAware.PersonService2;
import com.yizn.learn.springext.getspringcontex.ApplicationListener.PersonService3;
import com.yizn.learn.springext.getspringcontex.BeanFactoryAware.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * project : my-learn
 * <p> 测试类 </p>
 *
 * @author yisl
 * @date 2023-01-13【星期五】
 **/
@RestController
public class TestSpringController {
    @Autowired
    private PersonService personService;
    @Resource
    private PersonService2 personService2;

    @Resource
    private PersonService3 personService3;

    @GetMapping("/testBeanFactoryAware")
    public String testBeanFactoryAware(){
        personService.add();
        return "success";
    }
    @GetMapping("/testApplicationContextAware")
    public String testApplicationContextAware(){
        personService2.add();
        return "success";
    }
    @GetMapping("/testApplicationListener")
    public String testApplicationListener(){
        personService3.add();
        return "success";
    }
}
